import requests

session = requests.session()
url = 'https://match.yuanrenxue.com/jssm'
url_data = 'https://match.yuanrenxue.com/api/match/3'

headers = {
    'Host': 'match.yuanrenxue.com',
    'Connection': 'keep-alive',
    'Content-Length': '0',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache',
    'sec-ch-ua': '"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"',
    'sec-ch-ua-mobile': '?0',
    'User-Agent': 'yuanrenxue.project',
    'sec-ch-ua-platform': "Windows",
    'Accept': '*/*',
    'Origin': 'https://match.yuanrenxue.com',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Dest': 'empty',
    'Referer': 'https://match.yuanrenxue.com/match/3',
    'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cookie': 'sessionid=bquwssevq5rtc0csflgoz9axhtlid962'
}
li = []
for page in range(1, 5+1):
    # 设置请求头，session固定请求头
    session = requests.session()
    session.headers = headers
    # 请求jssm
    res = session.post(url)
    # print(res)
    # print(res.cookies

    # 请求数据接口
    params = {
        'page': str(page)
    }
    response = session.get(url_data, params=params)
    print(response.text)
    for i in response.json().get('data'):
        li.append(i.get('value'))
print(li)
print(max(li, key=li.count))  # 8717

""" headers请求头的参数顺序破解"""
